<?php
/**
 * Created by PhpStorm.
 * User: renshan
 * Date: 16-6-19
 * Time: 上午10:14
 */

namespace ApiBundle\Service;


use Symfony\Component\HttpFoundation\RequestStack;

/**
 * Class UserTokenService
 * @package ApiBundle\Service
 * 用或获取用户的api_token
 */
class UserTokenService
{
    protected $request;

    public function __construct(RequestStack $requestStack)
    {
        $this->request = $requestStack->getCurrentRequest();
    }

    /**
     * @return string || null
     */
    public function __toString()
    {
        return $this->request->get('api_token');
    }
}